package mq

import (
	"charging_pile/util/protocol/jiuxing"

	"github.com/zeromicro/go-zero/core/logx"
)

func handle33(nc *natsClient, in *jiuxing.Package) (jxMsg *jiuxing.Package) {
	msg := jiuxing.Msg33{}
	msg.Decode(in.Payload)
	logx.Infof("msg33:%+v", msg)
	resp := jiuxing.Msg34{}

	defer func() {

		jxMsg = &jiuxing.Package{
			Cmd:        byte(0x34),
			Sn:         in.Sn,
			Encryption: in.Encryption,
			PackageLen: 0,
			Payload:    []uint8{},
			Check:      0,
		}
		resp.Tm = formatJxTime()
		resp.Plug = msg.Plug
		resp.RecordSn = msg.RecordSn
		jxMsg.Payload = resp.Encode()

		jxMsg.PackageLen = uint16(len(jxMsg.Payload))

		logx.Infof("---------------------%d,%+v\n", jxMsg.PackageLen, resp)
	}()

	return nil
}

func init() {
	HandlerMap[uint8(0x33)] = handle33
}
